package by.grsu.epam.domain.service;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

import by.grsu.epam.domain.account.Account;

@Entity
// @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class Service {
	protected Long id;
	protected String name;
	protected String description;
	protected Integer cost;
	protected List<Account> accounts;
	
	public Service(){
	}

	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Integer getCost() {
		return cost;
	}

	public void setCost(Integer cost) {
		this.cost = cost;
	}

	@ManyToMany
	@JoinTable(name = "AccountService", 
		joinColumns = {@JoinColumn(name = "serviceId")},
		inverseJoinColumns = {@JoinColumn(name = "accountId")})
	public List<Account> getAccounts() {
		return accounts;
	}

	public void setAccounts(List<Account> accounts) {
		this.accounts = accounts;
	}	
}
